package com.abvnet.project.water.project.service;

import com.abvnet.common.utils.text.Convert;
import com.abvnet.project.water.project.domain.ProjectWater;
import com.abvnet.project.water.project.mapper.ProjectWaterMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 水质指标情况 服务层实现
 * 
 * @author duj
 * @date 2019-07-16
 */
@Service
public class ProjectWaterServiceImpl implements IProjectWaterService {
	@Autowired
	private ProjectWaterMapper projectWaterMapper;

	/**
     * 查询水质指标情况信息
     * 
     * @param waterId 水质指标情况ID
     * @return 水质指标情况信息
     */
    @Override
	public ProjectWater selectProjectWaterById(Long waterId) {
	    return projectWaterMapper.selectProjectWaterById(waterId);
	}

    @Override
    public ProjectWater selectProjectWaterByProjectId(Long projectId) {
        return projectWaterMapper.selectProjectWaterByProjectId(projectId);
    }

	/**
	 * 查询水质指标标准信息
	 *
	 * @param projectId 项目ID
	 * @return 水质指标标准情况信息
	 */
	@Override
	public ProjectWater selectProjectWaterStandardByProjectId(Long projectId) {
		return projectWaterMapper.selectProjectWaterStandardByProjectId(projectId);
	}

    /**
     * 查询水质指标情况列表
     * 
     * @param projectWater 水质指标情况信息
     * @return 水质指标情况集合
     */
	@Override
	public List<ProjectWater> selectProjectWaterList(ProjectWater projectWater) {
	    return projectWaterMapper.selectProjectWaterList(projectWater);
	}
	
    /**
     * 新增水质指标情况
     * 
     * @param projectWater 水质指标情况信息
     * @return 结果
     */
	@Override
	public int insertProjectWater(ProjectWater projectWater) {
	    return projectWaterMapper.insertProjectWater(projectWater);
	}
	
	/**
     * 修改水质指标情况
     * 
     * @param projectWater 水质指标情况信息
     * @return 结果
     */
	@Override
	public int updateProjectWater(ProjectWater projectWater) {
	    return projectWaterMapper.updateProjectWater(projectWater);
	}

	/**
     * 删除水质指标情况对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteProjectWaterByIds(String ids) {
		return projectWaterMapper.deleteProjectWaterByIds(Convert.toStrArray(ids));
	}

    @Override
    public void updateProjectWaterForList(List<ProjectWater> waterList) {
        waterList.forEach(w -> projectWaterMapper.updateProjectWater(w));
    }

    @Override
    public int batchProjectWater(List<ProjectWater> waterList) {
        return projectWaterMapper.batchProjectWater(waterList);
    }
}